package com.starry.module.system.api.oauth2.domain.vo;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description Scope描述
 * @Author xiaoke
 */
@Data
public class ScopeWithDescription {
    private static final String DEFAULT_DESCRIPTION = "UNKNOWN SCOPE - We cannot provide information about this permission, use caution when granting this.";
    private static final Map<String, String> scopeDescriptions = new HashMap<>();

    static {
        scopeDescriptions.put(
                "user.info",
                "访问你的个人信息、最新动态等"
        );
        scopeDescriptions.put(
                "message.write",
                "查看、创建、更新你的项目"
        );
    }

    public final String scope;
    public final String description;

    public ScopeWithDescription(String scope) {
        this.scope = scope;
        this.description = scopeDescriptions.getOrDefault(scope, DEFAULT_DESCRIPTION);
    }
}
